#
# make an Objective C version of Adventure
#

CC 				= gcc
DEBUG 			= -g
CFLAGS 			= -c -Wall $(DEBUG)
# Not sure how to set this automatically based on platform,
# so right now if compiling on Linux, comment out the
# APPLE_FLAGS below
#APPLE_FLAGS 	= -framework Foundation
# On Linux, the linker really wants these flags to be passed
SQLITE_FLAGS	= -pthread -ldl
LFLAGS 			= -lobjc $(APPLE_FLAGS) $(SQLITE_FLAGS) -Wall $(DEBUG)

# Our objects
OBJS = main.o game.o adventdb.o sqlite3.o

#
# Our default target
#
advent: $(OBJS)
	$(CC) $(LFLAGS) $(OBJS) -o advent

main.o : main.m base.h game.h
	$(CC) $(CFLAGS) main.m

game.o : game.m game.h base.h
	$(CC) $(CFLAGS) game.m

adventdb.o : adventdb.m adventdb.h base.h sqlite3.h
	$(CC) $(CFLAGS) adventdb.m

# We include the source for SQLite3 as that is where
# our database comes from. This is permitted by the
# fact that SQLite is officially in the public domain
# (see http://www.sqlite.org/copyright.html for more
# information)
sqlite3.o : sqlite3.c sqlite3.h
	$(CC) $(CFLAGS) -pthread -ldl sqlite3.c

clean:
	\rm *.o *~ advent

